<!-- 防疫检疫计划列表 -->
<template>
    <view class="container">
      <view class="main">
        <view v-if="fyjyPlanList.length === 0" class="empty">
          <view class="img">
            <image src="http://jiales.gz-yami.com/addr.png" />
          </view>
          <view class="txt"> 您还没有防疫检疫计划 </view>
        </view>
        <radio-group class="radio-group">
          <block v-for="(item, index) in fyjyPlanList" :key="index">
            <view class="address">
              <view class="personal" @tap="selAddrToOrder(item)">
                <view class="info-tit">
                  <text class="name">
                    计划名称：{{ item.planName }}
                  </text>
                  <text class="tel">
                    计划类型：{{ item.planType }}
                </text>
                  <image
                    src="@/static/images/icon/revise.png"
                    :data-reportId="item.id"
                    @tap.stop="toPandianReportDetail"
                  />
                </view>
                <view class="info-tit">
                  <text class="tel"> 疫苗名称：{{ item.planVaccineName }}</text>
                  <text class="tel"> 负责人：{{ item.planExecutor }} </text>
                  <text class="tel"> 开始时间：{{ item.planStartTime }} </text>
                  <text class="tel"> 结束时间：{{ item.planEndTime }} </text>
                </view>
                <view class="info-tit">
                  <text class="tel"> 计划完成数量：{{ item.originalNum }} </text>
                  <text class="tel"> 实际完成数量：{{ item.completedNum }} </text>
                </view>
                <view class="addr">
                  <text class="addr-get"> 地址：{{ item.address }} </text>
                  状态：
                  <uni-tag
                    v-if="item.status === '0'"
                    text="未开始"
                    type="error"
                    size="small"
                  />
                  <uni-tag
                    v-if="item.status === '1'"
                    text="已完成"
                    type="warning"
                    size="small"
                  />
                  <uni-tag
                    v-if="item.status === '2'"
                    text="已审核"
                    type="success"
                    size="small"
                  />
                </view>
              </view>
            </view>
          </block>
        </radio-group>
      </view>
    </view>
  </template>

  <script setup>
  const sts = ref(0);
  const title = ref("");
  const current = ref(1);
  const size = ref(10);
  const pages = ref(0);
  const tagid = ref(0);
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad((options) => {
    current.value = 1;
    pages.value = 0;

    if (options.tagid) {
      tagid.value = options.tagid;
    }

    loadFyjyPlanData(options);
  });

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom(() => {
    if (current.value < pages.value) {
      current.value = current.value + 1;
      loadFyjyPlanData();
    }
  });

  /**
   * 加载盘点报告数据列表
   */
  const loadFyjyPlanData = (options) => {
    const stsParam = sts.value;
    getFyjyPlan();
  };
  const fyjyPlanList = ref([]);
  const getFyjyPlan = () => {
    uni.showLoading();
    http
      .request({
        url: "/fyjy/api/getPlan",
        method: "GET"
      })
      .then(({ data }) => {
        fyjyPlanList.value = data;
        uni.hideLoading();
      });
  };


  const toPandianReportDetail = (e) => {
    const pandianReportId = e.currentTarget.dataset.reportId;
    uni.navigateTo({
      url: "/pages/pandian/pandianReportDetail?reportId=" + pandianReportId,
    });
  };
  </script>

  <style scoped lang="scss">
  @use "./fyjyPlan.scss";
  </style>
